package ad.android.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import ad.android.util.Constants;

/**
 * TblArea entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tbl_area", catalog = Constants.CATALOG)
public class Area implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -9200223293805907646L;
	private Long id;
	private String areaName;
	private Set<Ad> tblAds = new HashSet<Ad>(0);

	// Constructors

	/** default constructor */
	public Area() {
	}

	/** full constructor */
	public Area(String areaName, Set<Ad> tblAds) {
		this.areaName = areaName;
		this.tblAds = tblAds;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "ID", unique = true, nullable = true)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "AREA_NAME", length = 200)
	public String getAreaName() {
		return this.areaName;
	}
 
	public void setAreaName(String areaName) {
		this.areaName = areaName;
	}

	@ManyToMany(targetEntity = Ad.class, mappedBy = "tblArea",cascade=CascadeType.REFRESH, fetch=FetchType.LAZY)
	public Set<Ad> getTblAds() {
		return this.tblAds;
	}

	public void setTblAds(Set<Ad> tblAds) {
		this.tblAds = tblAds;
	}

}